package com.macvon.live;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;

import androidx.annotation.NonNull;

import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.livebroadcast.activities.LiveMainActivity;

public class LiveModule extends ReactContextBaseJavaModule {
    private Context mContext;

    public LiveModule(@NonNull ReactApplicationContext reactContext) {
        super(reactContext);
        this.mContext = reactContext;
    }

    @NonNull
    @Override
    public String getName() {
        return "LiveMgr";
    }


    @ReactMethod
    public void startLiveActivity(){
            ReactApplicationContext context = getReactApplicationContext();
            Activity activity = context.getCurrentActivity();
            if (activity != null) {
                Intent intent = new Intent(context, LiveMainActivity.class);
                activity.startActivity(intent);
            }
    }
}
